While defensive programming effectively guarantees the condition of one method's input, it becomes repetitive if it is pervasive across a series of methods. 尽管防御性编程有效地保证了方法的输入条件,但如果在一系列方法中使用它,不免过于重复。
For this type of problem, developers often employ defensive programming techniques that aim to catch potential errors before they wreak havoc. 对于这类问题,开发人员通常会使用防御性编程技术,该技术专门用来在发生摧毁性后果前捕捉潜在错误。
Combining defensive programming techniques with aspect-oriented programming ( through design by contract) is one way to keep the strong line of defense without all the repetitive coding. 把防御性编程技术和面向方面编程(通过契约式设计)联系起来是抵御所有重复性代码的一道坚强防线。
Defensive programming constructs have prevented many a defect, but the constructs themselves tend to litter code with repetitive logic. 防御性编程结构阻止了一个又一个缺陷,但这些结构本身却不免为代码添加了重复的逻辑。
Defensive programming is all about having assertions at the right place in your code. 防御性编程与让断言位于您代码中的正确位置密切相关。
Find out what happens when you combine defensive programming, design by contract, and an easy-to-use generic validation framework called OVal. 尝试为应用程序整合进防御性编程、契约式设计和一种叫做OVal的易用的通用验证框架。
In this case, defensive programming seems to have done the trick. 在本例中,防御性编程似乎解决了问题。
Those familiar with aspect oriented programming, or AOP, will recognize this as a crosscutting concern, meaning that defensive programming techniques span horizontally across a code base. 熟悉面向方面编程(或AOP)的人们会把它认为是横切关注点,这意味着防御性编程技术横跨了代码库。
Finding all the fields in advance is a defensive programming step to eliminate one of the potential problems with using reflection. 预先找到所有的字段是一种防错性编程的步骤,这样做可以消除使用反射时带来的一个潜在的问题。
Object verification is a classic defensive programming strategy for dealing with uncertainty. 对象验证是处理不确定性的一项经典的防御性编程策略。
But here's where I'm going to practice a little bit of defensive programming. 但是这儿我们要把编程的,防御性做的好一些。
Defensive Programming: your code must not make assumptions about anything received over the network. 防御性编程:你的代码绝对不能对通过网络接收到的任何信息做出假设。
Use Defensive Programming to Realize Software Fault Tolerance 使用防卫式程序设计实现软件容错